package 笔试2.百度.two;


import java.util.Scanner;

/*
4
2 6 5 4
1 5 7 6
9 8 8 7
1 4 7 8
 */
//--对折
public class Main {


    public static void main(String[] args) {

        int[][] g = {
//                {2,6,5,4},
//                {1,5,6,7},
//                {9,8,8,7},
//                {1,4,7,8}
                {1,2},
                {3,4}
        };

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        g = new int[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                g[i][j]=sc.nextInt();
            }
        }
        if(N==0){
            System.out.println(0);
            return;
        }

        int[][] shuzhe=g;
        if(g.length==1){
            System.out.println(g[0][0]);
            return;
        }

        while(true){
            g=shuzhe;
            int[][] hengzhe = hengzhe(g);
            if(hengzhe.length==1){
                System.out.println(hengzhe[0][0]);
                return;
            }

            shuzhe = shuzhe(hengzhe);
            if(shuzhe.length==1){
                System.out.println(shuzhe[0][0]);
                return;
            }

        }
//        int[][] g2 = hengzhe(g);
//        MHUtils.ptIntShuzu(g2);
//        int[][] g3 = shuzhe(g2);
//        MHUtils.ptIntShuzu(g3);

    }

    static int[][] hengzhe(int[][] g) {
        int[][] G = new int[g.length][g[0].length/2];

        int N = g[0].length/2;
        for(int i=0;i<G.length;i++){
            for(int j=0;j<N;j++){
                G[i][j]=(g[i][j]+g[i][j+N]);
            }
        }
        return G;
    }
    static int[][] shuzhe(int[][] g) {
        int[][] G = new int[g.length/2][g[0].length];

        int N = g.length/2;
        for(int i=0;i<N;i++){
            for(int j=0;j<G.length;j++){
                G[i][j]=(g[i][j]+g[i+N][j]);
            }
        }
        return G;
    }
}
